{include file="header" }
{include file="sibar" }
<div class="main-content">
    <div class="main-content-inner">
        <div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="{:U('index/index')}">首页</a>
                </li>
                <li>
                    <a href="{:U('index')}">系统管理</a>
                </li>
                <li>
                    <span>系统配置</span>
                </li>
            </ul>
        </div>
        <div class="page-content">
            <div class="page-header">
                <h1>{$meta_title}</h1>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <form>
                        <input type="hidden" value="{$info.id ?? ''}" id="setting_id">

                        <div class="form-group">
                            <label for="setting_group">配置分组</label>
                            <select class="form-control" id="setting_group">
                                <?php foreach($group_list as $key => $item): ?>
                                <option value="{$key}" <?php if(isset($info) && $info['group']==$key): ?>selected<?php endif;?>>{$item}</option>
                                <?php endforeach;?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="setting_type">配置类型</label>
                            <select class="form-control" id="setting_type">
                                <?php foreach($type_list as $key => $item): ?>
                                <option value="{$key}" <?php if(isset($info) && $info['type']==$key): ?>selected<?php endif;?>>{$item}</option>
                                <?php endforeach;?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="setting_name">配置标识</label>
                            <input type="text" class="form-control" id="setting_name" placeholder="配置标识" value="{$info.name ?? ''}">
                        </div>
                        <div class="form-group">
                            <label for="setting_title">配置标题</label>
                            <input type="text" class="form-control" id="setting_title" placeholder="配置标题" value="{$info.title ?? ''}">
                        </div>
                        <div class="form-group">
                            <label for="setting_value">配置值</label>
                            <textarea id="setting_value" class="form-control">{$info.value ?? ''}</textarea>
                        </div>
                        <div class="form-group">
                            <label for="setting_options">配置项</label>
                            <textarea id="setting_options" class="form-control">{$info.options ?? ''}</textarea>
                        </div>
                        <div class="form-group">
                            <label for="setting_tip">配置说明</label>
                            <textarea id="setting_tip" class="form-control">{$info.tip ?? ''}</textarea>
                        </div>

                        <div class="form-group">
                            <label for="setting_sort">排序</label>
                            <input type="text" class="form-control" value="{$info.sort ?? '0'}" id="setting_sort" placeholder="排序">
                        </div>
                        <p>
                            <a id="save" class="btn btn-primary btn-sm">确认提交</a>
                            <a href="#" class="btn btn-sm domall-back">返回</a>
                        </p>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $('#save').click(function(){
            var data = {
                id: $('#setting_id').val(),
                group: $('#setting_group').val(),
                type: $('#setting_type').val(),
                name:$('#setting_name').val(),
                title: $('#setting_title').val(),
                value: $('#setting_value').val(),
                options: $('#setting_options').val(),
                tip: $('#setting_tip').val(),
                sort: $('#setting_sort').val()
            };

            $.post("{$post_url}", data, function(info){
                alert(info.msg);
                if(info.code == 1){
                    if(info.url){
                        location.href=info.url;
                    }else{
                        window.history.go(-1);
                    }
                }
            }, 'json');
        });
    });
</script>

{include file="footer" }